<div id="main" role="main">
		<div class="tab-content tab-addtabs">
			<div id="content">
				<div class="row">
					<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
						 <div class="content">
							<form class="layui-form" >
									<div class="layui-form-item">
										<label class="layui-form-label">
											项目名称
										</label>
										<div class="layui-input-block">
											<input type="text" class="layui-input" id="name" value="{$info.i_name}">
										</div>
									</div>
									<div class="layui-form-item">
										<label class="layui-form-label">
											项目作者
										</label>
										<div class="layui-input-block">
											<input type="text" class="layui-input" id="author" value="{$info.i_author}">
										</div>
									</div>
									<div class="layui-form-item">
										<label class="layui-form-label">
											项目描述
										</label>
										<div class="layui-input-block">
											<textarea class="layui-textarea" id="des">{$info.i_des}</textarea>
										</div>
									</div>
									<div class="layui-form-item">
										<label class="layui-form-label">
											项目LOGO
										</label>
										<div class="layui-input-block">
											<button type="button" id="post_logo" class="layui-btn layui-btn-sm layui-btn-lg layui-btn-normal" style="margin: 8px 0 0 0px">上传图片</button>
											<img src="{$info.i_logo}" id="add_logo" width="50">
										</div>
									</div>

							</form>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>

												
<script>
layui.use(['form','upload'], function(){
	var upload = layui.upload,form = layui.form;
	var uploadCert = upload.render({
        elem: '#post_logo' //绑定元素
        , url: '{:url("post_logo")}' //上传接口
        , accept: 'file'
        , data: {
            type: '1'
        }
        , done: function (res) {
            //上传完毕回调
            if (res.code != '00') {
                $.thinkmimi({Content : res.msg,Type: 2,Align: 'right',OutTime: 2000,});
            } else {
                $.thinkmimi({Content : res.msg,Type: 1,Align: 'right',OutTime: 2000,});
				$("#add_logo").attr('src', res.data);
				$("#add_logo").css('width','50px')
            }
        }
        , error: function () {
            //请求异常回调
        }
    });
});

function doSubimt() {
	var res;
	var name        = $('#name').val();
	var author      = $('#author').val();
	var des         = $('#des').val();
	var post_logo   = $('#add_logo').attr('src');
	var data        = {'id':'{$info.i_id}','name':name,'author':author,'des':des,'post_logo':post_logo};

	if (name == '') {
		$.thinkmimi({Content : '请输入项目名称', Type:2, Align:'right', OutTime:2000});return false;
	}
	if (author == '') {
		$.thinkmimi({Content : '请输入项目作者', Type:2, Align:'right', OutTime:2000});return false;
	}
	if (post_logo == '') {
		$.thinkmimi({Content : '请上传项目LOGO', Type:2, Align:'right', OutTime:2000});return false;
	}

	$.ajax({
		type: 'post',
		data: data,
		async: false,
		url: "{:url('upd')}",
		success: function(data) {
			var array = eval('('+data+')');
			res = array;
			if (array['code'] == '01') {
				$.thinkmimi({Content : array['msg'], Type:2, Align:'right', OutTime:2000});
				res = false;
			}
		}
	});

	return res;
}
</script>